using Domain.Examin;
using MediatR;
using ReturnValue;
using System.Collections.Generic;

namespace MES.Server.API.Application.Command.ApprovalProcess
{
    public class SaveApprovalFlowDesignCommand : IRequest<ApiResult<bool>>
    {
        /// <summary>
        /// 业务ID（采购单ID）
        /// </summary>
        public long BusinessId { get; set; }

        /// <summary>
        /// 业务类型（如：PurchaseOrder）
        /// </summary>
        public string BusinessType { get; set; }

        /// <summary>
        /// 流程ID
        /// </summary>
        public long ProcessId { get; set; }

        /// <summary>
        /// 流程名称
        /// </summary>
        public string ProcessName { get; set; }

        /// <summary>
        /// 当前登录用户ID
        /// </summary>
        public long CurrentUserId { get; set; }

        /// <summary>
        /// 流程节点列表
        /// </summary>
        public List<ApprovalNodeInfo> Nodes { get; set; }

        /// <summary>
        /// 节点之间的连接关系
        /// </summary>
        public List<NodeConnection> Connections { get; set; }
    }

    /// <summary>
    /// 审批节点信息
    /// </summary>
    public class ApprovalNodeInfo
    {
        /// <summary>
        /// 节点ID
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 节点名称
        /// </summary>
        public string NodeName { get; set; }

        /// <summary>
        /// 节点类型（1:开始、2:审批、3:结束）
        /// </summary>
        public int NodeType { get; set; }

        /// <summary>
        /// 节点描述
        /// </summary>
        public string NodeDescription { get; set; }

        /// <summary>
        /// 审批时限（小时）
        /// </summary>
        public int TimeLimit { get; set; }

        /// <summary>
        /// 审批人角色ID
        /// </summary>
        public long? ApproverRoleId { get; set; }

        /// <summary>
        /// 审批人角色名称
        /// </summary>
        public string ApproverRoleName { get; set; }

        /// <summary>
        /// 审批人用户ID
        /// </summary>
        public long? ApproverUserId { get; set; }

        /// <summary>
        /// 审批人用户名称
        /// </summary>
        public string ApproverUserName { get; set; }

        /// <summary>
        /// 部门ID
        /// </summary>
        public long? DepartmentId { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        public string DepartmentName { get; set; }
    }

    /// <summary>
    /// 节点连接关系
    /// </summary>
    public class NodeConnection
    {
        /// <summary>
        /// 连接ID
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 源节点ID
        /// </summary>
        public string SourceNodeId { get; set; }

        /// <summary>
        /// 目标节点ID
        /// </summary>
        public string TargetNodeId { get; set; }
    }
}
